#include <reg52.h>
#include"intrins.h"

sbit KEY1 = P3^4;
sbit KEY2 = P3^5;
sbit KEY3 = P3^6;
sbit ENA=P1^2;
sbit IN1=P1^1;
sbit IN2=P1^0;


void Delay5us()
{
	_nop_();_nop_();_nop_();_nop_();
	_nop_();_nop_();_nop_();_nop_();
	_nop_();_nop_();_nop_();_nop_();
}

int main()
{
	while(1)
	{
		if(KEY1 == 0)
		{
		 Delay5us();
		 if(KEY1 == 0)
		 {
		 	ENA=1;
			IN1=0;
			IN2=1;
			while(!KEY1);
		 }
		 	//P1 = 0xff;
		}

		if(KEY2 == 0)
		{
		 Delay5us();
		 if(KEY2 == 0)
		 {
		 	ENA=1;
			IN1=1;
			IN2=0;
			//P1 = 0x00;
			while(!KEY2);
		 }
		 //	P1 = 0xff;
		}

		if(KEY3 == 0)
		{
		 Delay5us();
		 if(KEY3 == 0)
		 {
		 	ENA=0;
		//	P1 = 0x00;
			while(!KEY3);
		 }
		 //	P1 = 0xff;
		}
	
	}	
}